<?php
/**
 * CFK ONE Season Style Switcher for Wordpress 1.5
 * (c) by Christian F. Kaufhold, 2005 @ Mainz, Germany
 * http://cfkone.net
 *
 * DateTimeUtil class
 * Version: 1.0
 * 
 * Provides util-methods for date/time-handlings
 */
 
class DateTimeUtil{

	/**
	 * Checks, if a date is within a time-period
	 * 
	 * @param $checkDate - type: Date, the date, that has to be checked 
	 * @param $beginDate - type: Date, the beginning date of the period
	 * @param $endDate - type: Date, the ending date of the period
	 * @return boolean returns true or false
	 */
	function &isInPeriod($checkDate, $beginDate, $endDate){
		$result = false;
		$diff1 = $checkDate - $beginDate;
		$diff2 = $checkDate - $endDate;
		if( $diff1 >= 0 && $diff2 <= 0){
			$result = true;
		}
		
		return $result;
	}
	
	/**
	 * Checks, if a date is today
	 * 
	 * @param $checkDate - type: Date, the date, that has to be checked
	 * @return boolean returns true or false 
	 */
	function &isToday($checkDate){
		$result = false;
		$diff = time() - $checkDate;
		if( $diff >= 0 && $diff <= 86400 ){
			$result = true;
		}
		return $result;
	}
	
} 
?>
